/** @deprecated use rslib build */
import { register } from "node:module";
import path from "node:path";
import { defineConfig } from "rolldown";
// entrypoint.mjs
// v-module

/**
 * @power ms-vscode.ts-file-path-support
 * @template TBaseDir
 * @typedef {string & { baseDir?: TBaseDir }} RelativeFilePath
 */

/**
 * @description Resolve relative path to absolute path.
 * @param {RelativeFilePath<'$dir'>} s
 * @returns {string}
 */
const p2 = (s) => {
  console.log(path.resolve(import.meta.dirname, s));
  return path.resolve(import.meta.dirname, s);
};

export default defineConfig({
  platform: "node",
  checks: {
    invalidExport: "error",
    circularDependency: "warn",
  },
  input: "./rspack/loader/cjs.cts",
  output: {
    dir: p2("./rspack/dist"),
    format: "cjs",
    preserveModules: true,
    banner: "// @ts-nocheck",
  },
  optimization: {},
  resolve: {
    tsconfigFilename: p2("./tsconfig.node.json"),
  },
});
